CREATE TABLE BABEL_5103_T1(
    COL1 VARCHAR(2000) NOT NULL,
    COL2 AS CAST(COL1 AS NCHAR(2001)),
    COL3 AS CAST(COL1 AS VARCHAR(MAX)),
    COL4 AS CAST(COL1 AS NVARCHAR(2001)),
    COL5 AS CAST(COL1 AS TEXT),
    COL6 AS CAST(COL1 AS NTEXT)
)
GO

INSERT INTO BABEL_5103_T1 (COL1)
VALUES (N'Registration Card - Standard');
GO

INSERT INTO BABEL_5103_T1 (COL1)
VALUES (N'بطاقة التسجيل - قياسية');
GO

INSERT INTO BABEL_5103_T1 (COL1)
VALUES (N'登録カード–標準');
GO

CREATE VIEW BABEL_5103_V1 AS
SELECT COL1, COL2, COL3, COL4, COL5, COL6
FROM BABEL_5103_T1;
GO

CREATE VIEW  BABEL_5103_V2 AS 
SELECT CASE 3 
        WHEN 1 THEN N'登録カード–標準'
        WHEN 2 THEN CAST('char0' AS NVARCHAR(10))
        WHEN 3 THEN CAST(N'登録カード–標準' AS VARCHAR(10))
END AS RESULT
GO

CREATE FUNCTION BABEL_5103_F1(@ARG NVARCHAR(1001)) 
RETURNS NVARCHAR(1001)
AS
BEGIN 
    RETURN (
        CASE 
         WHEN @ARG = 'REGULAR' THEN 'REGULAR'
         WHEN @ARG = N'登録カード–標準' THEN N'登録カード–標準'
         WHEN @ARG = N'بطاقة التسجيل - قياسية'THEN N'بطاقة التسجيل - قياسية'
        END
    );
END;
GO

CREATE TABLE BABEL_5341_T1 (
    COL1 NUMERIC(20,2),
    COL2 DECIMAL(20,2),
    COL3 NUMERIC(38,0),
    COL4 DECIMAL(38,0),
    COL5 NUMERIC(2,0),
    COL6 DECIMAL(2,0)
);
GO

INSERT INTO BABEL_5341_T1 (COL1, COL2, COL3, COL4, COL5, COL6)
VALUES (12345.67, 54321.98, 1234567890123456789, 9876543210987654321, 42, 99);
GO

INSERT INTO BABEL_5341_T1 (COL1, COL2, COL3, COL4, COL5, COL6)
VALUES (98765.43, 12345.67, 9876543210987654321, 1234567890123456789, 10, 50);
GO

INSERT INTO BABEL_5341_T1 (COL1, COL2, COL3, COL4, COL5, COL6)
VALUES (11111.11, 22222.22, 1111111111111111111, 2222222222222222222, 11, 22);
GO

INSERT INTO BABEL_5341_T1 (COL1, COL2, COL3, COL4, COL5, COL6)
VALUES (33333.33, 44444.44, 3333333333333333333, 4444444444444444444, 33, 44);
GO

INSERT INTO BABEL_5341_T1 (COL1, COL2, COL3, COL4, COL5, COL6)
VALUES (55555.55, 66666.66, 5555555555555555555, 6666666666666666666, 55, 66);
GO

CREATE VIEW BABEL_5341_V1 AS 
SELECT CASE 3 
    WHEN 1 THEN CAST(123.45 AS NUMERIC(10,2))
    WHEN 2 THEN CAST(678.90 AS NUMERIC(10,2))
    WHEN 3 THEN CAST(1234.56 AS NUMERIC(10,2))
END AS RESULT
GO

CREATE VIEW BABEL_5341_V2 AS 
SELECT CASE 2
    WHEN 1 THEN CAST(123.45 AS NUMERIC(10,2))
    WHEN 2 THEN CAST(6789 AS NUMERIC(10,0))
    WHEN 3 THEN CAST(12.3456 AS NUMERIC(10,4))
END AS RESULT
GO

CREATE VIEW BABEL_5341_V3 AS 
SELECT CASE 1
    WHEN 1 THEN CAST(1234567890123456 AS NUMERIC(20,0))
    WHEN 2 THEN CAST(9876543210987654 AS NUMERIC(20,0))
    WHEN 3 THEN CAST(1111222233334444 AS NUMERIC(20,0))
END AS RESULT
GO

CREATE VIEW BABEL_5341_V4 AS 
SELECT CASE 3
    WHEN 1 THEN CAST(0.0001 AS NUMERIC(10,4))
    WHEN 2 THEN CAST(0.0002 AS NUMERIC(10,4))
    WHEN 3 THEN CAST(0.0003 AS NUMERIC(10,4))
END AS RESULT
GO

CREATE VIEW BABEL_5341_V5 AS 
SELECT CASE 2
    WHEN 1 THEN CAST(-123.45 AS NUMERIC(10,2))
    WHEN 2 THEN CAST(678.90 AS NUMERIC(10,2))
    WHEN 3 THEN CAST(-1234.56 AS NUMERIC(10,2))
END AS RESULT
GO

CREATE VIEW BABEL_5341_V6 AS 
SELECT CASE 3
    WHEN 1 THEN CAST(100 + 23.45 AS NUMERIC(10,2))
    WHEN 2 THEN CAST(1000 - 321.10 AS NUMERIC(10,2))
    WHEN 3 THEN CAST(500 * 2.5 AS NUMERIC(10,2))
END AS RESULT
GO

CREATE FUNCTION BABEL_5341_F1(@ARG NUMERIC(20,2)) 
RETURNS NUMERIC(20,4)
AS
BEGIN 
    RETURN (
        CASE 
            WHEN @ARG = 100.00 THEN CAST(123.45 AS NUMERIC(20,2))
            WHEN @ARG = 200.00 THEN CAST(6789 AS NUMERIC(20,0))
            WHEN @ARG = 300.00 THEN CAST(12.3456 AS NUMERIC(20,4))
            ELSE @ARG
        END
    );
END;
GO

CREATE TABLE BABEL_5341_T2
(
    [integer_one] INT,
    [integer_two] INT
);
GO
INSERT INTO BABEL_5341_T2
(
    [integer_one],
    [integer_two]
)
VALUES
(1, 3);
GO
